/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entidades;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Andres
 */
@Entity
@Table(name = "ITEMS", catalog = "", schema = "PROYECTO")
@NamedQueries({
    @NamedQuery(name = "Items.findAll", query = "SELECT i FROM Items i"),
    @NamedQuery(name = "Items.findByIditem", query = "SELECT i FROM Items i WHERE i.iditem = :iditem"),
    @NamedQuery(name = "Items.findByInicio", query = "SELECT i FROM Items i WHERE i.inicio = :inicio"),
    @NamedQuery(name = "Items.findByFin", query = "SELECT i FROM Items i WHERE i.fin = :fin")})
public class Items implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "IDITEM", nullable = false)
    private Integer iditem;
    @Basic(optional = false)
    @Column(name = "INICIO", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    private Date inicio;
    @Basic(optional = false)
    @Column(name = "FIN", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    private Date fin;
    @JoinColumn(name = "PROGRAMACION_CODPRO", referencedColumnName = "CODIGOPROGRAMACION", nullable = false)
    @ManyToOne(optional = false, fetch = FetchType.EAGER)
    private Programacion programacion;
    @JoinColumn(name = "PERSONA_CODIGOPERSONA", referencedColumnName = "CODIGOPERSONA", nullable = false)
    @ManyToOne(optional = false, fetch = FetchType.EAGER)
    private Persona persona;
    @JoinColumn(name = "ACTIVIDADES_CODIGO", referencedColumnName = "CODIGO", nullable = false)
    @ManyToOne(optional = false, fetch = FetchType.EAGER)
    private Actividades actividades;
    @OneToMany(mappedBy = "items", fetch = FetchType.EAGER)
    private List<Actividadesacademicas> actividadesacademicasList;

    public Items() {
    }

    public Items(Integer iditem) {
        this.iditem = iditem;
    }

    public Items(Integer iditem, Date inicio, Date fin) {
        this.iditem = iditem;
        this.inicio = inicio;
        this.fin = fin;
    }

    public Integer getIditem() {
        return iditem;
    }

    public void setIditem(Integer iditem) {
        this.iditem = iditem;
    }

    public Date getInicio() {
        return inicio;
    }

    public void setInicio(Date inicio) {
        this.inicio = inicio;
    }

    public Date getFin() {
        return fin;
    }

    public void setFin(Date fin) {
        this.fin = fin;
    }

    public Programacion getProgramacion() {
        return programacion;
    }

    public void setProgramacion(Programacion programacion) {
        this.programacion = programacion;
    }

    public Persona getPersona() {
        return persona;
    }

    public void setPersona(Persona persona) {
        this.persona = persona;
    }

    public Actividades getActividades() {
        return actividades;
    }

    public void setActividades(Actividades actividades) {
        this.actividades = actividades;
    }

    public List<Actividadesacademicas> getActividadesacademicasList() {
        return actividadesacademicasList;
    }

    public void setActividadesacademicasList(List<Actividadesacademicas> actividadesacademicasList) {
        this.actividadesacademicasList = actividadesacademicasList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (iditem != null ? iditem.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Items)) {
            return false;
        }
        Items other = (Items) object;
        if ((this.iditem == null && other.iditem != null) || (this.iditem != null && !this.iditem.equals(other.iditem))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entidades.Items[iditem=" + iditem + "]";
    }

}
